﻿<Page x:Class="SlotDuino.UI.Pages.TrackSelect"
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 xmlns:pages="clr-namespace:SlotDuino.UI.Pages" 
 xmlns:converter="clr-namespace:SlotDuino.Converter"
 mc:Ignorable="d" 
	Title="TrackSelect" Loaded="Page_Loaded" Unloaded="Page_Unloaded">

    <Page.Resources>
        <CollectionViewSource x:Key="serversSource" d:DesignSource="{d:DesignInstance pages:NetTrack, CreateList=True}" />
        <converter:NotNull x:Key="NotNull" />
    </Page.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="42"/>
        </Grid.RowDefinitions>

        <GroupBox Header="Selecione uma pista:" Grid.Row="0">
            <DataGrid MinHeight="200" MinWidth="450" ItemsSource="{Binding Source={StaticResource serversSource}}" AutoGenerateColumns="False" SelectionMode="Single" DataContext="{Binding}" Name="dataGrid" CanUserAddRows="False">
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding Path=Address}" Header="IP" IsReadOnly="True" />
                    <DataGridTextColumn Binding="{Binding Path=Name}" Header="Nome" IsReadOnly="True" />
                </DataGrid.Columns>
            </DataGrid>
        </GroupBox>

        <Button Grid.Row="1" Content="Atualizar lista" Height="32" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="90" Name="btnRefresh" Click="btnRefresh_Click" />
        <Button x:Name="btnHost" Grid.Row="1" Content="Endereço especifico..." Height="32" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="125" d:LayoutOverrides="GridBox" Margin="0,0,180,0" Click="btnHost_Click" />
        <Button x:Name="btnCancel" Grid.Row="1" Content="Cancelar" Height="32" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="80" Margin="0,0,90,0" IsCancel="True" Command="NavigationCommands.BrowseBack" />
        <Button x:Name="btnConnect" Grid.Row="1" Content="Conectar" Height="32" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="80" IsDefault="True" IsEnabled="{Binding Source={StaticResource serversSource}, Path=/, Converter={StaticResource NotNull}}" Click="btnConnect_Click" />
    </Grid>
</Page>
